package com.compass.doctor.ui.patient.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import com.compass.doctor.R
import com.compass.doctor.databinding.LayoutScreenItemBinding
import com.compass.framework.adapter.BaseBindViewHolder
import com.compass.framework.adapter.BaseRecyclerViewAdapter
import com.compass.framework.model.Dictionaries
import com.compass.framework.model.PrescriptionStatus
import com.compass.framework.utils.getColorFromResource
import com.compass.framework.utils.getDrawableResource

/**
 * Description： 字典类adapter
 * Date:2024/1/4 20:17
 */
class DictionariesAdapter : BaseRecyclerViewAdapter<Dictionaries, LayoutScreenItemBinding>() {
    override fun onBindDefViewHolder(
        holder: BaseBindViewHolder<LayoutScreenItemBinding>,
        item: Dictionaries?,
        position: Int
    ) {
        if (item == null) return
        holder.binding.apply {
            tvScreenName.text = item.label
            if (item.isSelect){
                tvScreenName.background= getDrawableResource(R.drawable.btn_shape_screen_selected)
                tvScreenName.setTextColor(getColorFromResource(R.color.white))
            }else{
                tvScreenName.setTextColor(getColorFromResource(R.color.color_2e344a))
                tvScreenName.background= getDrawableResource(R.drawable.bg_shape_round_f8_3)
            }

        }
    }

    override fun getViewBinding(
        layoutInflater: LayoutInflater,
        parent: ViewGroup,
        viewType: Int
    ): LayoutScreenItemBinding {
        return LayoutScreenItemBinding.inflate(layoutInflater, parent, false)
    }
}